const App = {
    mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            page: {
                value1: '',
                value2: '',
                PageNumber: 1, //页码
                RowAmount: 10,
                Condition: window.btoa(unescape(encodeURIComponent("%%,%%")))
            },
        }
    },
    mounted() {

    },
    methods: {
        getList() {
            const that = this;
            const { TableName } = JSON.parse(document.getElementById("table").getAttribute("data-options"));
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
                method: "post",
                data: {
                    SQLSerialNumber: 's_base_sql_table_config',
                    Condition: window.btoa(unescape(encodeURIComponent("%" + this.relativePath + "%"))),
                    ExtensionCondition: '',
                },
                success: (data) => {
                    if (data.length > 0) {
                        that.columns = data;
                        that.checkedFields = data;
                        that.fields = data;
                        // that.loading = true;
                        // that.postgetList(that.page);
                        
                    } 
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest)
                },
            });
        },
        check() {
            this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%%")));
            this.postgetList(this.page)
        },
        Treedata() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'innovation_mechanism',
                    Condition: "Row_Status='0'",
                },
                success: (data) => {
                    this.treeData = data; // 直接使用 this
                    this.handleNodeClick(data[0]);
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        },
        //树的点击筛选事件
        handleNodeClick(data, node) {
            if (data) {
                this.page.value2 = data.Innovation_Mechanism_SerialNumber
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%,%" + this.page.value2 + "%")));
                this.postgetList(this.page)
            } else {
                this.loading = false
            }
            
        },
        handleShow(row){
            window.location.href = './show.html?nodeKey=' + row.Innovation_Mechanism_Detail_SerialNumber + '&nodeKey1=' + row.Innovation_Mechanism_SerialNumber
        },
        handleAdd(row) {
            window.location.href = './add.html?action=Add&nodeKey=' + row.News_Tag_SerialNumber
        },
        handleZj(row) {
            window.location.href = './show1.html?nodeKey=' + row.Innovation_Mechanism_Detail_SerialNumber + '&nodeKey1=' + row.Innovation_Mechanism_SerialNumber
        },
        handleDW(row) {
            window.location.href = './show2.html?nodeKey=' + row.Innovation_Mechanism_Detail_SerialNumber + '&nodeKey1=' + row.Innovation_Mechanism_SerialNumber
        }
    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
